﻿using CinemaMaestro.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace CinemaMaestro.WindowsApplication.EndPoints
{
    public class ReservationEndPoints
    {

        private const string ReservationsUrl = "api/reservations";

        private HttpClient client;

        public ReservationEndPoints(HttpClient client)
        {
            this.client = client;
        }

        public async Task<List<ReservationViewModel>> GetReservationsForScreening(int screeningId)
        {
            List<ReservationViewModel> reservations = new List<ReservationViewModel>();
            HttpResponseMessage response = await client.GetAsync("api/reservationForScreening/" + screeningId);
            if (response.IsSuccessStatusCode)
            {
                reservations = await response.Content.ReadAsAsync<List<ReservationViewModel>>();
            }
            return reservations;
        }

    }
}
